<html><head><title>RawKey</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">RawKey()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#3A3966"><b>RawKey</b></font>()</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Returns the raw key code of the last <a href="inkey.html">Inkey()</a> function call. 
It's useful for extended (non-ASCII) keys (for example, function keys, arrows, etc). 

</blockquote><p><b>Parameters</b></p><blockquote>
None.


</blockquote><p><b>Return value</b></p><blockquote>

Returns the key code of the last pressed key. 

</blockquote><p><b>Remarks</b></p><blockquote>

It is not only alphanumeric keys that have an ASCII value. The escape key (27), 
return key (13) tab key (9) and backspace key (8) are just four examples. 
A table with ASCII codes you find <a href="../reference/ascii.html">here</a>. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenConsole</font>()
<font color="#3A3966">    PrintN</font>(&quot;Press Escape to exit&quot;)
  
    <b><font color="#3A3966">Repeat</font></b>
      KeyPressed$ =<font color="#3A3966"> Inkey</font>()
      
      <b><font color="#3A3966">If</font></b> KeyPressed$ &lt;&gt; &quot;&quot;
        
<font color="#3A3966">        PrintN</font>(&quot;You pressed: &quot; + KeyPressed$)
<font color="#3A3966">        PrintN</font>(&quot;It has a raw code of: &quot;+<font color="#3A3966">Str</font>(<font color="#3A3966">RawKey</font>()))
        
      <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">RawKey</font>()
      
<font color="#3A3966">        PrintN</font>(&quot;You pressed a non ASCII key.&quot;)
<font color="#3A3966">        PrintN</font>(&quot;It has a raw code of: &quot;+<font color="#3A3966">Str</font>(<font color="#3A3966">RawKey</font>()))
        
      <b><font color="#3A3966">Else</font></b>
<font color="#3A3966">        Delay</font>(20) <font color="#3A3966">; Don't eat all the CPU time, we're on a multitask OS</font>
      <b><font color="#3A3966">EndIf</font></b>
    
    <b><font color="#3A3966">Until</font></b> KeyPressed$ =<font color="#3A3966"> Chr</font>(27) <font color="#3A3966">; Wait until escape is pressed</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="inkey.html">Inkey()</a>, <a href="input.html">Input()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>Windows</Blockquote></p><center><- <a href=printn.html>PrintN()</a> - <a href="index.html">Console Index</a> - <a href="readconsoledata.html">ReadConsoleData()</a> -><br><br>

</body></html>